<?php
namespace system\core;

/**
 * Parser
 * 
 * This class can parse pseudo-variables in the view files
 */
class Parser 
{
    public function parse( $buffer ) 
    {
        $output = $buffer;
        $data   = $this->getData();
        
        if ( $data )
        {
            foreach ( $data as $item => $replace )
            {
                $output = str_replace($item, $replace, $output);
            }
        }
        
        return $output;
    }
    
    public function getData()
    {
        $data = array(
            '{base_url}' => Config::get('config', 'base_url'),
            '{app_name}' => Config::get('config', 'app_name'),
            '{page_rendered}' => Benchmark::get('application'),
            '{page_rendered_ms}' => Benchmark::get('application', TRUE),
            
        );
        return $data;
    }
    
}

/* End of file Parser.php */
